package com.zbkj.dal.entity.order;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;

import java.time.LocalDateTime;

@Data
@TableName("eb_order_rent_shared_record")
public class OrderRentSharedRecord {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty("承享记录号")
    private String rentCode;
    @ApiModelProperty("订单号")
    private String orderNo;
    @ApiModelProperty("订单明细ID")
    private Integer orderDetailId;
    @ApiModelProperty("用户id")
    private Integer uid;
    @ApiModelProperty("承享天数")
    private Integer rentDays;
    @ApiModelProperty("承享开始日期")
    private LocalDateTime rentStartDate;
    @ApiModelProperty("承享结束日期")
    private LocalDateTime rentEndDate;
    @ApiModelProperty("承享归还日期")
    private LocalDateTime rentReturnDate;
    @ApiModelProperty("承享宽容开始时间")
    private LocalDateTime expiredStartDate;
    @ApiModelProperty("承享宽容结束时间")
    private LocalDateTime expiredEndDate;
    @ApiModelProperty("超宽容期天数")
    private Integer overdueDays;
    @ApiModelProperty("承享类型  INITIAL:首次  RENEWAL:续期")
    private String type;
    /**
     * @see RentRecordStatus
     */
    @ApiModelProperty("承享状态  id:正常完成 0:承享就绪中 1:正常承享中 2:已到归还期 3:已经到宽容期 9:超过宽容期")
    private Integer status;
    @ApiModelProperty("是否开启中 0:关闭 1:开启")
    private Integer active;

    @ApiModelProperty("是否删除")
    @TableField(value = "is_del")
    private Integer del;

    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;
    @ApiModelProperty("承享订单记录表")
    private LocalDateTime updateTime;


    public enum RentType {

        // 首次
        INITIAL,
        // 续期
        RENEWAL;

    }

    @Getter
    public enum RentRecordStatus {

        // 就绪中
        READY(0),
        // 承享中
        RENTING(1),
        // 已经到归还期
        RETURN(2),
        // 已经到宽容期
        EXPIRE(3),
        // 超过宽容期
        OVERDUE(9),
        ;

        private final Integer code;

        RentRecordStatus(Integer code) {
            this.code = code;
        }
    }

}
